package umacis.data.elements;

/**
 * It's a list of keys to keep track of the keys on the phone, the keys can have names here, 
 *
 * @author Administrator
 *
 */

public class Key {
	public int code;
	public String name;
	/**
	 * constructor to use in vectorOfKeys
	 * @param code
	 * @param name
	 */
	public Key(int code, String name) {
		this.code = code;
		this.name = name;
	}

//	public SystemKey(int code) {
//		this.code = code;
//		
//	}
//
//	public SystemKey(SystemKey keyObject) {
//	// TODO Auto-generated constructor stub
//}
	public boolean equals(Object object) {
		if (object instanceof Key) {
			if (((Key) object).code == code) return true; }
		return false;
	}
	
	public String toString() {
		return String.valueOf(code)+" "+name;
	}
	
//	public void read(ConfigurationFile cf) throws IOException {
//		code = cf.readInt(); name = cf.readString();  
//		
//	}
//
//	public void write(ConfigurationFile cf) throws IOException {
//		cf.writeEditable(code); cf.writeEditable(name);  
//		
//	}
	
//	public static int getState(boolean isShiftDown, boolean isKeyHeld) {
//		int state = 0;
//		if (isKeyHeld) state += 2;
//		if (isShiftDown) state += 1;
//		return state;
//	}
	

	
	
	public final static int NUMBER_of_key_states = 4;
	public final static int NORMAL = 0;
	public final static int SHIFTED = 1;
	public final static int HELD = 2;
	public final static int SHIFTEDANDHELD = 3;
	public final static String STATE_NAMES[] = { "Unmodified", "Shifted", "Held", "Shifted+Held"};
	
	public final static int NUMBER_OF_KEYS_ON_NOKIA_KEYPAD = 21;
	public final static int UP = -1;
	public final static int DOWN = -2;
	public final static int LEFT = -3;
	public final static int RIGHT = -4;
	public final static int SELECT = -5;
	public final static int LSK = -6;
	public final static int RSK = -7;
	public final static int ONE = 49;
	public final static int TWO = 50;
	public final static int THREE = 51;
	public final static int FOUR = 52;
	public final static int FIVE = 53;
	public final static int SIX = 54;
	public final static int SEVEN = 55;
	public final static int EIGHT = 56;
	public final static int NINE = 57;
	public final static int ZERO= 48;
	public final static int STAR = 42;
	public final static int HASH = 35;
	public final static int DELETE = -8;
	public final static int GREENKEY = -10; 
	
	public final static int UNDEFINED = 99999;
	
	public final static int[] CODES = { ONE, TWO,
		THREE, FOUR, FIVE, SIX,
		SEVEN, EIGHT, NINE, ZERO,
		STAR, HASH, LSK, SELECT,
		RSK, UP, DOWN, LEFT,
		RIGHT, DELETE, GREENKEY};

	public final static String NAMES[] = { "1", "2", "3", "4", "5",
		"6", "7", "8", "9", "0", "Star", "Hash", "LSK", "Select", "RSK", "Up",
		"Down", "Left", "Right", "C", "Dial" };
	
	
}